package practica6;

import java.util.LinkedList;

import engines.BreadthFirstSearchEngine;
import engines.DepthFirstSearchWithVisitedControlEngine;
import engines.IterativeDeepeningSearchEngine;
import framework.IRule;
import framework.SearchEngine;
import framework.SearchProblem;

public class OchoBaldosasProblem {

    /**
     * @param args
     */
    public static void main(String[] args) {

	StateB initialState = new StateB();

	IRule<StateB> rule1 = new ReglaAv1();
	IRule<StateB> rule2 = new ReglaAv2();
	IRule<StateB> rule3 = new RegalAv3();
	IRule<StateB> rule4 = new ReglaAv4();

	LinkedList<IRule<StateB>> rules = new LinkedList<IRule<StateB>>();

	rules.add((ReglaAv1) rule1);
	rules.add((ReglaAv2) rule2);
	rules.add((RegalAv3) rule3);
	rules.add((ReglaAv4) rule4);

	SearchProblem<StateB> problem = new SearchProblem<StateB>(initialState,
		rules);

	SearchEngine<StateB> engine3 = new IterativeDeepeningSearchEngine<StateB>(
		problem);
	
	SearchEngine<StateB> engine1 = new BreadthFirstSearchEngine<StateB>(
		problem);
	SearchEngine<StateB> engine2 = new DepthFirstSearchWithVisitedControlEngine<StateB>(
		problem);

//	for (int i = 0; i < 3; i++) {
//	    for (int j = 0; j < 3; j++) {
//		System.out.print(initialState.stateI(i, j));
//	    }
//	    System.out.println("");
//	}
	
	System.out.println(engine3.performSearch());
    }
}
